---@class Table_MissionItem
local Table_MissionItem = class("Table_MissionItem");

function Table_MissionItem:ctor()
    self.Id = 0;    --唯一ID
    self.Title = "";    --任务标题
    self.Desc = "";    --任务描述
    self.Icon = "";    --任务图标
    self.Atlas = "";    --图标图集
    self.TaskType = 0;    --任务类型
    self.FuncType = 0;    --功能点类型
    self.FuncNum = 0;    --功能点数量
    self.NextId = 0;    --后置任务id
    self.UId = 0;    --跳转界面id
    self.SortId = 0;    --优先级
    self.AwardType = 0;    --奖励类型
    self.AwardId = 0;    --奖励ID
    self.AwardNum = 0;    --奖励数量
    self.ShowType = 0;    --客户端显示类型
    self.Finish = 0;    --完成后处理
end

function Table_MissionItem:Load(reader)
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Id = tonumber(self.temp); end
    self.Title = reader:ReadString();
    self.Desc = reader:ReadString();
    self.Icon = reader:ReadString();
    self.Atlas = reader:ReadString();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.TaskType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.FuncType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.FuncNum = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.NextId = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.UId = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.SortId = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.AwardType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.AwardId = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.AwardNum = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.ShowType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Finish = tonumber(self.temp); end
    self.temp = nil;
end

---@class Table_MissionMgr : IDataMgr
local Table_MissionMgr = class("Table_MissionMgr", IDataMgr);

function Table_MissionMgr:FileName()
    return "Txt/Mission.txt";
end

---@return Table_MissionItem
function Table_MissionMgr:GetItemById(id)
    return self.super:GetItemById(id)
end

---@return Table_MissionItem
function Table_MissionMgr:GetItemByIdx(idx)
    return self.super:GetItemByIdx(idx)
end

function Table_MissionMgr:Load(reader)
    local item = Table_MissionItem.new();
    item:Load(reader);
    self.mItemDic[item.Id] = self.mDataCount;
    table.insert(self.mItemList, item);
end

return Table_MissionMgr;